package org.jiajie.coffeecodes.demo.jvm.classfile.attributes.impl;

import org.jiajie.coffeecodes.demo.jvm.classfile.ClassReader;
import org.jiajie.coffeecodes.demo.jvm.classfile.attributes.AttributeInfo;
import org.jiajie.coffeecodes.demo.jvm.classfile.constantpool.ConstantPool;

/**
 * @author jie
 */
public class SignatureAttribute implements AttributeInfo {

    private ConstantPool constantPool;
    private int signatureIdx;

    public SignatureAttribute(ConstantPool constantPool) {
        this.constantPool = constantPool;
    }

    @Override
    public void readInfo(ClassReader reader) {
        this.signatureIdx = reader.readUint16();
    }

    public String signatureIdx() {
        return this.constantPool.getUTF8(this.signatureIdx);
    }
}
